﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>UploaderTest</title>
    <script type="text/javascript">
        var imageUploader;
        window.onload = function () {
            imageUploader = document.getElementById('imageUploader');
           setTimeout(callFlash, 1000);
            
        };
        
        function callFlash()
        {
        
        imageUploader.setJSFuncName([
            'selectFileCallback', 
            'exceedFileCallback', 
            'deleteFileCallback', 
            'startUploadCallback',
            'uploadCompleteCallback',
            'uploadErrorCallback',
            'allCompleteCallback'
        ]);
        }
      
    </script>
</head>
<body>
    <div>
       
            <embed width="540" height="300" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer"
                type="application/x-shockwave-flash" id="imageUploader" src="/imageUploader.swf?x=@Guid.NewGuid()"
                flashvars="url=home/imageUploadTest&amp;uploadDataFieldName=picdata&amp;picDescFieldName=picDesc&amp;maxSize=4&amp;width=540&amp;height=300&amp;gridWidth=135&amp;gridHeight=135&amp;picWidth=88&amp;picHeight=108&amp;compressSize=3&amp;maxNum=32&amp;compressLength=1280&amp;mode=0&amp;backgroundUrl=/background.png&amp;listBackgroundUrl=background2.png&amp;buttonUrl=button.png"
                ver="9.0.0" wmode="transparent" />
    </div><div id="log"></div>
    <script type="text/javascript">
    function getMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}else{
return document[movieName]
}
}
        function consolelog(str) {
            var el = document.getElementById("log");
            el.innerHTML += str + "<br />";
        }
        function selectFileCallback(selectFiles) {
            consolelog("选择了如下文件：");
            var obj;
            for (var i = 0, iLen = selectFiles.length;
 i < iLen;
 i++) {
                obj = selectFiles[i];
                consolelog(obj.index, obj.name, obj.size);
            }
            consolelog("===================================");
        }
        function exceedFileCallback(file) {
            consolelog("文件超出大小限制：");
            consolelog(file.index, file.name, file.size);
            consolelog("===================================");
        }
        function deleteFileCallback(delFiles) {
        alert(delFiles);
            consolelog("删除了如下文件：");
            var obj;
            for (var i = 0, iLen = delFiles.length;
 i < iLen;
 i++) {
                obj = delFiles[i];
                consolelog(obj.index, obj.name, obj.size);
            }
            consolelog("===================================");
        }
        function startUploadCallback(file) {
            consolelog("开始上传如下文件：");
            consolelog(file.name, file.size);
            consolelog("===================================");
        }
        function uploadCompleteCallback(data) {
            consolelog("上传成功", data);
        }
        function uploadErrorCallback(data) {
            consolelog("上传失败", data);
        }
        function allCompleteCallback() {
            consolelog("全部上传成功");
        }
        function upload() {
            flash.upload();
        }
        function pause() {
            flash.pause();
        }
       
        /*
        (function () {
        flash.upload();
        })();
        */
        /*
        (function () {
        flash.pause();
        })();
        */
</script>
</body>
</html>
